In [6]:
val nameOpt = Option("Amir")
def printName(name: String) = println(name)
In [7]:
nameOpt.foreach(printName)
In [4]:
val anotherOpt = None
In [5]:
anotherOpt.foreach(printName)
This is a great pattern for optinally generating side-effects given an option that you take from the command line, namely in conjunction with scallop.